﻿using BackupContracts.Sql;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Xml.Serialization;

namespace BackupContracts.Tasks
{
    [XmlInclude(typeof(SqlBackupTaskAction))]
    public class Task : ModelBase
    {
        private string _Id;
        [XmlIgnore]
        public string Id
        {
            get { return _Id; }
            set { SetField(ref _Id, value, () => Id); }
        }

        private string _Name;
        [XmlIgnore]
        public string Name
        {
            get { return _Name; }
            set { SetField(ref _Name, value, () => Name); }
        }

        private ObservableCollection<Schedule> _Schedules;
        public ObservableCollection<Schedule> Schedules
        {
            get { return _Schedules; }
            set { SetField(ref _Schedules, value, () => Schedules); }
        }

        private ObservableCollection<TaskAction> _Actions;
        public ObservableCollection<TaskAction> Actions
        {
            get { return _Actions; }
            set { SetField(ref _Actions, value, () => Actions); }
        }

        private bool _Enabled;
        [XmlIgnore]
        public bool Enabled
        {
            get { return _Enabled; }
            set { SetField(ref _Enabled, value, () => Enabled); }
        }

        private DateTimeOffset? _LastExecution;
        [XmlIgnore]
        public DateTimeOffset? LastExecution
        {
            get { return _LastExecution; }
            set { SetField(ref _LastExecution, value, () => LastExecution); }
        }

        private DateTimeOffset? _LastExecutionStart;
        [XmlIgnore]
        public DateTimeOffset? LastExecutionStart
        {
            get { return _LastExecutionStart; }
            set { SetField(ref _LastExecutionStart, value, () => LastExecutionStart); }
        }
    }
}
